


def get_token(source,separator):
    p = source.find(separator)

    if p == 0:
        ret = source
        source = ""
    else:
     ret = source[0:p]
     source = source[-(len(source)-(p+len(separator))):]

    return ret,source


def get_tolist(se,separator):
    li = []
    source = se
    p = source.find(separator)
    while p>0:
        if p == 0:
            ret = source
            source = ""
            li.append(ret)
            p = source.find(separator)
        else:
            ret = source[0:p]
            source = source[-(len(source)-(p+len(separator))):]
            # print source 
            li.append(ret)
            p = source.find(separator)
            # print p
            if p <= 0 and len(source) > 0 :
                # print 'geaj'
                li.append(source) 
    return li


def get_todict(se,separator,colon):
    di = {}
    li = []
    li = get_tolist(se,separator)
    for i in li:
        get_token(i,'=')
    return di